package edu.cornell.cubooks.domain;

import java.io.Serializable;


import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * The Business object which represents bid.
 * 
 * @author CUBooks Team
 *
 */
@Entity
@Table(name="bid")
public class Bid implements Serializable {
	
	private static final long serialVersionUID = 6763995533218395914L;
	
	@EmbeddedId
	private BidPK bid = new BidPK();
	 
	@Transient
    private Integer posting;
    
	@Transient
    private float price;
    
    // many bids belong to one user
    @ManyToOne
    @JoinColumn(name="user_id")
    public User user;

	public Posting getPosting() {
		return bid.getPosting();
	}
	
	public void setPosting(Posting posting) {
		this.bid.setPosting(posting);
	}
	
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	public float getPrice() {
		return bid.getPrice();
	}
	public void setPrice(float price) {
		this.bid.setPrice(price);
	}
}
